var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/*
 * @Description: 类的继承
 * @Autor: HuiSir<273250950@qq.com>
 * @Date: 2021-04-29 10:51:55
 * @LastEditTime: 2021-04-30 11:49:46
 */
var Persion = /** @class */ (function () {
    // 定义构造函数
    function Persion(name, age, gender) {
        this.gender = "男";
        this.name = name;
        this.age = age;
        this.gender = gender ? gender : this.gender;
    }
    // 定义实例方法
    Persion.prototype.sayHi = function (str) {
        return "\u6211\u53EB".concat(this.name, ",\u6211\u4ECA\u5E74").concat(this.age, "\u5C81\u4E86\uFF0C\u6211\u662F\u4E2A").concat(this.gender, "\u5B69\u5B50\u3002").concat(str);
    };
    return Persion;
}());
/* 定义一个类，继承Persion */
var Student = /** @class */ (function (_super) {
    __extends(Student, _super);
    function Student() {
        var args = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
        }
        return _super.apply(this, args) || this;
    }
    // 子类重写父类方法，使用super调用父类方法
    Student.prototype.sayHi = function (str) {
        console.log("这是子类重写的方法");
        return _super.prototype.sayHi.call(this, str);
    };
    return Student;
}(Persion));
var student = new Student("张三", 18);
console.log(student.sayHi("你叫啥？"));
/* 省略constructor */
var Student2 = /** @class */ (function (_super) {
    __extends(Student2, _super);
    function Student2() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    // 子类重写父类方法，使用super调用父类方法
    Student2.prototype.sayHi = function (str) {
        console.log("这是子类2重写的方法");
        return _super.prototype.sayHi.call(this, str);
    };
    return Student2;
}(Persion));
